using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SkiaSharp;

namespace FlowChartV2.Libraries
{
    public class Lines
    {
        public Figure figure1 { get; set; }
        public Figure figure2 { get; set; }
        public Lines(Figure first, Figure second)
        {
            this.figure1 = first;
            this.figure2 = second;
        }
        public void DrawLeft(ref SKCanvas canvas, SKPaint paint)
        {
            SKPoint[] points =
            {
                new SKPoint(figure1.bottom.x,figure1.bottom.y),
                new SKPoint(figure1.bottom.x,figure1.bottom.y+10),

                new SKPoint(figure1.bottom.x,figure1.bottom.y+10),
                new SKPoint(figure2.left.x - 10,figure1.bottom.y + 10),

                new SKPoint(figure2.left.x - 10,figure1.bottom.y + 10),
                new SKPoint(figure2.left.x - 10,figure2.left.y),

                new SKPoint(figure2.left.x - 10,figure2.left.y),
                new SKPoint(figure2.left.x,figure2.left.y),
            };
            canvas.DrawPoints(SKPointMode.Lines, points, paint);
            SKPoint[] arrow =
            {
                new SKPoint(figure2.left.x - 5,figure2.left.y - 3),
                new SKPoint(figure2.left.x,figure2.left.y),

                new SKPoint(figure2.left.x,figure2.left.y),
                new SKPoint(figure2.left.x - 5,figure2.left.y + 3),
            };
            canvas.DrawPoints(SKPointMode.Lines, arrow, paint);
        }
        public void DrawRight(ref SKCanvas canvas, SKPaint paint)
        {
            SKPoint[] points =
            {
                new SKPoint(figure1.right.x,figure1.right.y),
                new SKPoint(figure1.right.x + figure2.size.w / 4,figure1.right.y),

                new SKPoint(figure1.right.x + figure2.size.w / 4,figure1.right.y),
                new SKPoint(figure1.right.x + figure2.size.w / 4,figure2.top.y - 10),

                new SKPoint(figure1.right.x + figure2.size.w / 4,figure2.top.y - 10),
                new SKPoint(figure2.top.x,figure2.top.y - 10),

                new SKPoint(figure2.top.x,figure2.top.y - 10),
                new SKPoint(figure2.top.x,figure2.top.y),
            };
            canvas.DrawPoints(SKPointMode.Lines, points, paint);
        }
    }
}